package org.example.shop.dao;

import org.example.shop.pojo.UserInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 用户数据操作
 */
@Repository
public interface UserDao extends JpaRepository<UserInfo, Integer> {
    //    UserInfo findByUsername(String username);
    @Query(nativeQuery = true, value = "select * from users where usernamename=:name")
    Optional<UserInfo> findByUsername(@Param("name") String username);
}
